package top.hcode.hoj.remoteJudge.task;

import lombok.extern.slf4j.Slf4j;
import top.hcode.hoj.remoteJudge.task.Impl.*;
import top.hcode.hoj.utils.Constants;

@Slf4j
public class RemoteJudgeFactory {

    public static RemoteJudgeStrategy selectJudge(String judgeName) {
        Constants.RemoteOJ remoteOJ = Constants.RemoteOJ.getRemoteOJ(judgeName);
        if (remoteOJ == null) {
            log.error("不支持的远程判题平台：" + judgeName);
            return null;
        }

        Constants.RemoteJudge remoteJudge = Constants.RemoteJudge.getTypeByName(remoteOJ.name());
        switch (remoteJudge) {
            case HDU_JUDGE:
                return new HDUJudge();
            case CF_JUDGE:
                return new CodeForcesJudge();
            case POJ_JUDGE:
                return new POJJudge();
            case GYM_JUDGE:
                return new GYMJudge();
            case SPOJ_JUDGE:
                return new SPOJJudge();
            case ATCODER_JUDGE:
                return new AtCoderJudge();
            case LIBRE_JUDGE:
                return new LibreJudge();
            case LUOGU_JUDGE:
                return new LuoguJudge();
            default:
                return null;
        }
    }
}
